﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataLib.BLL
{
    public partial class PEmail
    {
        private readonly DataLib.DAL.PEmail dal = new DataLib.DAL.PEmail();
        /// <summary>
        /// 获取JSON
        /// </summary>
        /// <param name="key"></param>
        /// <param name="oType"></param>
        /// <returns></returns>
        public string GetJsonPEmail(string key, string oType)
        {
            return dal.GetJsonPEmail(key, oType);
        }

          /// <summary>
       /// 根据多个联系邮件字符串返回相关信息列表
       /// </summary>
       /// <param name="elist"></param>
       /// <param name="oType"></param>
       /// <returns></returns>
        public List<Model.PEmail> GetEList(string elist, string oType)
        {
            return dal.GetEList(elist, oType);
        }        

        /// <summary>
       /// 用多个联系人发信
       /// </summary>
       /// <param name="elist"></param>
       /// <param name="oType"></param>
       /// <returns></returns>
        public string GetStrEList(string elist, string oType)
        {
            List<Model.PEmail> l = dal.GetEList(elist, oType);
            string result = "";
            for (int i = 0; i < l.Count; i++)
            {
                if (i > 0)
                {
                    result = result + "," + l[i].lable;
                }
                else
                {
                    result = l[i].lable;
                }
            }
            return result;
        }
    }
}
